<form class="clearfix pb10" action="<?php echo $this->createUrl('/comparison/default/list') ?>" method="get">
    <div id="wrap">
        <h1>区外学校对比分析报表</h1>
        <div class="statisticsNav">
            <div class="school">
                <h1>学校</h1>
                <ul>
                    <li><input type="checkbox" value="whole" id="whole" /><label for="whole">全部</label></li>
                    <?php
                    if (!empty($data['school'])):
                        $sik = 0;
                        foreach ($data['school'] as $k => $v):
                            ?>
                            <li>
                                <input type="checkbox" value="<?php echo $k; ?>" name="schoolVal" id="school<?php echo $sik; ?>" checked/>
                                <label for="school<?php echo $sik; ?>"><?php echo $v; ?></label>
                            </li>
                            <?php
                            $sik++;
                        endforeach;
                        ?>
                            <?php endif; ?>
                        </ul>
                    </div>
			<div class="statisticsType_navSun">
				<a href="javascript:;" class="on" val="0"><span>◆</span>总分上线</a>
				<a href="javascript:;" val="1"><span>◆</span>总分+2B</a>
			</div>
			<p style="clear:both;"></p>
		</div>
		<div class="fl">
			<ul class="statisticsType_nav">
				<li class="on" val="1">本一率</li>
				<li val="2">本二率</li>
				<li val="3">高分段</li>
				<li val="4">最高分</li>
			</ul>
		</div>
		<div id="statisticsChart"></div>
		<input type="submit" value="导出" name="info[import]" class="b_a_n border_3 back_bgfb w80 height32 fontc_FFF fonts_12 cursor fr mr20 mt10 mb20" />
		<div id="statisticsTABLE">
			
			<table class="fontc_666 height32" align="center" valign="middle" border="0" cellpadding="0" cellspacing="0" width="100%">
				<thead class=" fontc_999" bgColor="#4e98bd" style="color:#fff;">
					<tr height="38">
						<th width="150" align="center" rowspan="3" valign="middle" class="border_d"><span style="padding:0 5px;">学校</span></th>
						<th width="" align="center" colspan="4" valign="middle" class="border_d"><span style="padding:0 5px;">本一率</span></th>
						<th width="" align="center" colspan="6" valign="middle" class="border_d"><span style="padding:0 5px;">本二率</span></th>
						<th width="" align="center" colspan="2" valign="middle" class="border_d"><span style="padding:0 5px;">高分段（人数）</span></th>
						<th width="" align="center" colspan="2" valign="middle" class="border_d"><span style="padding:0 5px;">最高分</span></th>
					</tr>
					<tr height="38">
						<th  align="center" colspan="2"  valign="middle" class="border_d"><span style="padding:0 5px;">文科</span></th>
						<th  align="center" colspan="2" valign="middle" class="border_d"><span style="padding:0 5px;">理科</span></th>
						<th  align="center" colspan="3" valign="middle" class="border_d"><span style="padding:0 5px;">文科</span></th>
						<th  align="center" colspan="3" valign="middle" class="border_d"><span style="padding:0 5px;">理科</span></th>
						<!--<th  align="center" rowspan="2" valign="middle" class="border_d"><span style="padding:0 5px;">文科(<?php echo $data['glk_point']; ?>)</span></th>
						<th  align="center" rowspan="2" valign="middle" class="border_d"><span style="padding:0 5px;">理科(<?php echo $data['gwk_point']; ?>)</span></th>-->
						<th  align="center" rowspan="2" valign="middle" class="border_d"><span style="padding:0 5px;">文科(<?php echo $data['gwk_point']; ?>)</span></th>
						<th  align="center" rowspan="2" valign="middle" class="border_d"><span style="padding:0 5px;">理科(<?php echo $data['glk_point']; ?>)</span></th>
						<th  align="center" rowspan="2" valign="middle" class="border_d"><span style="padding:0 5px;">文科</span></th>
						<th  align="center" rowspan="2" valign="middle" class="border_d"><span style="padding:0 5px;">理科</span></th>
					</tr>
					<tr height="38">
						<th  align="center"  valign="middle" class="border_d"><span style="padding:0 5px;">总分上线</span></th>
						<th  align="center"  valign="middle" class="border_d"><span style="padding:0 5px;">总分+2B</span></th>
						<th  align="center"  valign="middle" class="border_d"><span style="padding:0 5px;">总分上线</span></th>
						<th  align="center"  valign="middle" class="border_d"><span style="padding:0 5px;">总分+2B</span></th>
						<th  align="center"  valign="middle" class="border_d"><span style="padding:0 5px;">总分上线</span></th>
						<th  align="center"  valign="middle" class="border_d"><span style="padding:0 5px;">总分+BC</span></th>
						<th  align="center"  valign="middle" class="border_d"><span style="padding:0 5px;">总分+CC</span></th>
						<th  align="center"  valign="middle" class="border_d"><span style="padding:0 5px;">总分上线</span></th>
						<th  align="center"  valign="middle" class="border_d"><span style="padding:0 5px;">总分+BC</span></th>
						<th  align="center"  valign="middle" class="border_d"><span style="padding:0 5px;">总分+CC</span></th>
					</tr>
				</thead>
				<tbody style="background:#fff;">
				<?php if (isset($scorse)): ?>
                    <?php foreach ($scorse as $akey => $aVal): ?>
                        <tr height="35">
                        	<td align="center" class="border_d"><?php echo $aVal['school_name'];?></td>
                            <td align="center" class="border_d"><?php echo $aVal['ywk_num'];?></td>
                            <td align="center" class="border_d"><?php echo $aVal['ywdb_num'];?></td>
                            <td align="center" class="border_d"><?php echo $aVal['ylk_num'];?></td>
                            <td align="center" class="border_d"><?php echo $aVal['yldb_num'];?></td>
                            <td align="center" class="border_d"><?php echo $aVal['ewk_num'];?></td>
                            <td align="center" class="border_d"><?php echo $aVal['ewdb_num'];?></td>
                            <td align="center" class="border_d"><?php echo $aVal['ewcc_num'];?></td>
                            <td align="center" class="border_d"><?php echo $aVal['elk_num'];?></td>
                            <td align="center" class="border_d"><?php echo $aVal['eldb_num'];?></td>
                             <td align="center" class="border_d"><?php echo $aVal['elcc_num'];?></td>
                            <td align="center" class="border_d"><?php echo isset($aVal['gw_num'])?$aVal['gw_num']:0;?></td>
                            <td align="center" class="border_d"><?php echo isset($aVal['gl_num']) ? $aVal['gl_num'] : 0;?></td>
                            <td align="center" class="border_d"><?php echo isset($aVal['wsk']) ? $aVal['wsk'] : 0;;?></td>
                            <td align="center" class="border_d"><?php echo isset($aVal['lsk']) ? $aVal['lsk'] : 0;?></td>
                        </tr>
                    <?php endforeach; ?> 
                	<?php endif; ?>
				</tbody>
			</table>
		</div>
		<input type="hidden" value="<?php echo $data['exam_id']?>" name="exam_id">
		 
	</div>
	</form>
	<script>
	$(function(){
		var schoolNameVals = [];
		$(".school input[name='schoolVal']").each(function(){
			schoolNameVals.push( $(this).val() );
		})
		data={
			statisticsType_navVal : 1,
			schoolNameVal : schoolNameVals,
			statisticsType_navSunVal : 0,
			exam_id : <?php echo $data['exam_id'];?>
		};
        checkvalue(data);
        $( ".statisticsType_navSun a" ).click(function(){
            $.dialog.tips('数据加载中...',600,'loading.gif');
            var thisVal = $(this).attr("val"),
            schoolNameVal = [],
            data={
                    statisticsType_navSunVal : thisVal,
                    statisticsType_navVal : $( ".statisticsType_nav li.on" ).attr("val")
            };
            $(".school input[name='schoolVal']").each(function(){
                    schoolNameVal.push( $(this).val() );
            })
            data.schoolNameVal = schoolNameVal;
            $(this).addClass("on").siblings().removeClass("on");
            data.exam_id = <?php echo $data['exam_id']; ?>;
            checkvalue(data);
        })
        $( ".statisticsType_nav li" ).click(function(){
            $.dialog.tips('正在加载',600,'loading.gif');
            var thisVal = $(this).attr("val"),
            schoolNameVal = [],
            data={
                statisticsType_navVal : thisVal
            };
            $(".school input[name='schoolVal']").each(function(){
                schoolNameVal.push( $(this).val() );
            })
            data.schoolNameVal = schoolNameVal;
            if( thisVal == 2 || thisVal==3 || thisVal==4){
                if(thisVal==3 || thisVal==4){
                        $( ".statisticsType_navSun a" ).eq(0).hide();
                }else{
                        $( ".statisticsType_navSun a" ).eq(0).show();
                        data.statisticsType_navSunVal = $( ".statisticsType_navSun a" ).eq(0).attr("val");
                }
                $( ".statisticsType_navSun a" ).eq(1).hide();
            }else{
                $( ".statisticsType_navSun a" ).show();
                data.statisticsType_navSunVal = $( ".statisticsType_navSun a.on" ).attr("val");
            }
            $(this).addClass("on").siblings().removeClass("on");
            data.exam_id = <?php echo $data['exam_id']; ?>;
            checkvalue(data);
        })
        $( "#whole" ).change(function(){
            if($(this).attr("checked")){
                    $(this).parent().nextAll().find("input").attr( "checked",true );
            }else{
                    $(this).parent().nextAll().find("input").removeAttr( "checked" );
            }
        })
})
var key=0;
function checkvalue (data){
		
        $.post('/comparison/default/ajaxvalue', {data:data}, function(result) {
                if( key == 1 )$.dialog.tips('加载完成',0.5,'');
                key=1;
                var result = $.parseJSON(result );
                var data = {
                        dataNum : [
                        result.yzrow,
                        result.ywrow,
                        result.ylrow
                        ], //比率
                        categories : result.schoolname, //学校
                        lable : "人数",
                        unit : "%" //单位
                }
                YUEchart.schoolContrastChart( $("#statisticsChart"),data )
        })
}
</script>
